package com.qing.design.patterns.mediator.example.components;

import com.qing.design.patterns.mediator.example.mediator.Mediator;
import com.qing.design.patterns.mediator.example.mediator.Note;

import javax.swing.*;
import java.awt.event.ActionEvent;

public class DeleteButton extends JButton implements Component{


	private Mediator mediator;

	public DeleteButton() {
		super("Delete");
	}

	@Override
	public void setMediator(Mediator mediator) {
		this.mediator=mediator;
	}

	@Override
	protected void fireActionPerformed(ActionEvent event) {
		mediator.deleteNote();
	}

	public String getName(){
		return  "DelButton";
	}

}
